<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" lang="zh-CN">

<div class="container-fluid">
    <div class="container">
        <form id="mappingAddForm" class="form-horizontal" role="form" method="post">
            <!-- 标题 -->
            <div class="row text-center">
                <h3>添加驱动</h3>
            </div>

            <!-- 操作 -->
            <div class="form-group">
                <div class="col-md-10"></div>
                <div class="col-md-2 text-right">
                    <button id="mappingSubmitBtn" type="button" class="btn btn-primary">
                        <span class="fa fa-save"></span>保存
                    </button>
                    <button id="mappingBackBtn" type="button" class="btn btn-default">
                        <span class="fa fa-reply"></span>返回
                    </button>
                </div>
            </div>

            <!-- 配置 -->
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-info">
                        <div class="panel-heading">
                            <h3 class="panel-title">驱动配置</h3>
                        </div>

                        <div class="panel-body">
                            <div class="form-group">
                                <!-- 数据源 -->
                                <label class="col-sm-2 control-label">数据源</label>
                                <div class="col-sm-4">
                                    <select name="sourceConnectorId" class="form-control select-control">
                                        <option th:each="c,s:${connectors}" th:value="${c?.id}" th:text="${c?.name + '(' + c?.config?.connectorType + ')'}" />
                                    </select>
                                </div>
                                <!-- 目标源 -->
                                <label class="col-sm-2 control-label">目标源</label>
                                <div class="col-sm-4">
                                    <select name="targetConnectorId" class="form-control select-control">
                                        <option th:each="c,s:${connectors}" th:value="${c?.id}" th:text="${c?.name + '(' + c?.config?.connectorType + ')'}" />
                                    </select>
                                </div>
                            </div>

                            <!-- 驱动名称 -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label">名称<strong class="text-primary">*</strong></label>
                                <div class="col-sm-10">
                                    <input class="form-control" name="name" type="text" maxlength="50" dbsyncer-valid="require" placeholder="名称" />
                                </div>
                            </div>

                            <!-- 匹配相似表 -->
                            <div class="form-group">
                                <div class="col-sm-2 text-right"><label>匹配相似表</label></div>
                                <div class="col-sm-10">
                                    <input class="dbsyncer_switch" id="autoMatchTable" name="autoMatchTable" type="checkbox">
                                </div>
                            </div>

                            <!-- 表映射关系 -->
                            <div class="form-group" id="tableGroups">
                                <div class="col-sm-2 text-right"><label>表映射关系</label><i class="fa fa-question-circle fa_gray" aria-hidden="true" title="适用于快速配置大量表映射关系场景"></i></div>
                                <div class="col-sm-10">
                                    <p class="text-muted">
                                        示例：数据源表|目标源表=源表字段A1*|目标字段A2*,源表字段B1|目标字段B2<i class="fa fa-question-circle fa_gray" aria-hidden="true" title="'|'表示映射关系，'='表示后面是表字段映射关系，有多个字段使用英文','拼接，'*'表示主键，如有多张表换行追加"></i>
                                        <a href="https://gitee.com/ghi/dbsyncer/wikis/%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C/%E6%89%B9%E9%87%8F%E9%85%8D%E7%BD%AE%E8%A1%A8%E6%98%A0%E5%B0%84%E5%85%B3%E7%B3%BB" title="操作手册>批量配置表映射关系"
                                           target='_blank'>参考文档</a>
                                    </p>
                                    <textarea name="tableGroups" class="form-control dbsyncer_textarea_resize_none" rows="20"></textarea>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>

        </form>
    </div>
</div>

<script th:src="@{/js/mapping/add.js}"></script>
</html>